// Day15手写：
// 1.手写算法：https://leetcode-cn.com/problems/sum-root-to-leaf-numbers/

/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
 var sumNumbers = function(root) {
    const dfs = (root, path) => {
        if (root == null) {
            return 0;
        }
        path = path * 10 + root.val;
        if (!root.left && !root.right) {
            return path;
        }
        return dfs(root.left, path) + dfs(root.right, path);
    };
    return dfs(root, 0);
};

2.手写题：https://bigfrontend.dev/zh/problem/remove-characters

/**
 * @param {string} input
 * @returns string
 */
 function removeChars(input) {
    // your code here
    let res = input.replace(/b/g, '').replace(/ac/g, '')
  
    while (res.match(/ac/)) {
      res = res.replace(/ac/g, '')
    }
    return res;
  
  }
